<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: Functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="IFXCYP_one-line.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MTB CAT1 Peripheral driver library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__sysclk__wco__funcs.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Functions<div class="ingroups"><a class="el" href="group__group__sysclk.html">SysClk       (System Clock)</a> &raquo; <a class="el" href="group__group__sysclk__wco.html">Watch Crystal Oscillator (WCO)</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gaca35f4a96f042a9c84df82083277c41f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__sysclk__returns.html#gad6699a184e2e3c01433251b0981558f3">cy_en_sysclk_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysclk__wco__funcs.html#gaca35f4a96f042a9c84df82083277c41f">Cy_SysClk_WcoEnable</a> (uint32_t timeoutus)</td></tr>
<tr class="memdesc:gaca35f4a96f042a9c84df82083277c41f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enables the WCO.  <a href="#gaca35f4a96f042a9c84df82083277c41f">More...</a><br /></td></tr>
<tr class="separator:gaca35f4a96f042a9c84df82083277c41f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9e8ae5164397bf3bd0374d957405b9cf"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysclk__wco__funcs.html#ga9e8ae5164397bf3bd0374d957405b9cf">Cy_SysClk_WcoOkay</a> (void)</td></tr>
<tr class="memdesc:ga9e8ae5164397bf3bd0374d957405b9cf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reports the status of the WCO_OK bit.  <a href="#ga9e8ae5164397bf3bd0374d957405b9cf">More...</a><br /></td></tr>
<tr class="separator:ga9e8ae5164397bf3bd0374d957405b9cf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0990b94c499652b8f5c2dd1cf6abf95e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysclk__wco__funcs.html#ga0990b94c499652b8f5c2dd1cf6abf95e">Cy_SysClk_WcoDisable</a> (void)</td></tr>
<tr class="memdesc:ga0990b94c499652b8f5c2dd1cf6abf95e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disables the WCO.  <a href="#ga0990b94c499652b8f5c2dd1cf6abf95e">More...</a><br /></td></tr>
<tr class="separator:ga0990b94c499652b8f5c2dd1cf6abf95e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf254b104b1e1020545103779a573da17"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysclk__wco__funcs.html#gaf254b104b1e1020545103779a573da17">Cy_SysClk_WcoBypass</a> (<a class="el" href="group__group__sysclk__wco__enums.html#ga54c5465a9f694e1e71cf1ca2598d2fd7">cy_en_wco_bypass_modes_t</a> bypass)</td></tr>
<tr class="memdesc:gaf254b104b1e1020545103779a573da17"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets whether the WCO is bypassed or not.  <a href="#gaf254b104b1e1020545103779a573da17">More...</a><br /></td></tr>
<tr class="separator:gaf254b104b1e1020545103779a573da17"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="gaca35f4a96f042a9c84df82083277c41f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaca35f4a96f042a9c84df82083277c41f">&#9670;&nbsp;</a></span>Cy_SysClk_WcoEnable()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__sysclk__returns.html#gad6699a184e2e3c01433251b0981558f3">cy_en_sysclk_status_t</a> Cy_SysClk_WcoEnable </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>timeoutus</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Enables the WCO. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">timeoutus</td><td>amount of time in microseconds to wait for the WCO to be ready. If WCO is not ready, WCO is stopped. To avoid waiting for WCO ready set this to 0, and manually check if WCO is okay using <a class="el" href="group__group__sysclk__wco__funcs.html#ga9e8ae5164397bf3bd0374d957405b9cf">Cy_SysClk_WcoOkay</a>.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Error / status code: <br />
CY_SYSCLK_SUCCESS - WCO successfully enabled <br />
CY_SYSCLK_TIMEOUT - Timeout waiting for WCO to stabilize CY_PRA_STATUS_* - For the PSoC 64 devices there are possible situations when function returns the PRA error status code <a class="el" href="group__group__pra__enums.html#ga60be13e12e82986f8c0d6c6a6d4f12c5">cy_en_pra_status_t</a> instead of <a class="el" href="group__group__sysclk__returns.html#gad6699a184e2e3c01433251b0981558f3">cy_en_sysclk_status_t</a>. This is because for PSoC 64 devices the function uses the PRA driver to change the protected registers. Refer to <a class="el" href="group__group__pra__enums.html#ga60be13e12e82986f8c0d6c6a6d4f12c5">cy_en_pra_status_t</a> for more details.</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="comment">/* Scenario: The WCO needs to source the backup clock for the real-time clock</span></div><div class="line"><span class="comment">                 operation. Timeout of 2ms is tolerable. The WCO pins are configured</span></div><div class="line"><span class="comment">                 using the gpio driver(SRSS_WCO_IN_PIN, SRSS_WCO_OUT_PIN). */</span></div><div class="line"></div><div class="line">    <span class="comment">/* Enable the WCO with a timeout of 2000 microseconds */</span></div><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__sysclk__returns.html#ggad6699a184e2e3c01433251b0981558f3a1563f761f963757b339ff05eb5a690ec">CY_SYSCLK_SUCCESS</a> != <a class="code" href="group__group__sysclk__wco__funcs.html#gaca35f4a96f042a9c84df82083277c41f">Cy_SysClk_WcoEnable</a>(2000))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="comment">/* Set the backup clock source to WCO */</span></div><div class="line">    <a class="code" href="group__group__sysclk__clk__bak__funcs.html#gab72e0702bafe7df920708eacefdb40dd">Cy_SysClk_ClkBakSetSource</a>(<a class="code" href="group__group__sysclk__clk__bak__enums.html#ggae43abac127a973232c6e4c1adbde0497a9a82c90148622105cc000167a9b0428b">CY_SYSCLK_BAK_IN_WCO</a>);</div></div><!-- fragment --></dd></dl>

</div>
</div>
<a id="ga9e8ae5164397bf3bd0374d957405b9cf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9e8ae5164397bf3bd0374d957405b9cf">&#9670;&nbsp;</a></span>Cy_SysClk_WcoOkay()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Cy_SysClk_WcoOkay </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reports the status of the WCO_OK bit. </p>
<dl class="section return"><dt>Returns</dt><dd>true = okay <br />
false = not okay</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="comment">/* Scenario: The WCO needs to source the backup clock for the real-time</span></div><div class="line"><span class="comment">                 clock operation. It needs to be enabled in a non-blocking</span></div><div class="line"><span class="comment">                 manner. The WCO pins are configured using the gpio driver</span></div><div class="line"><span class="comment">                 (SRSS_WCO_IN_PIN, SRSS_WCO_OUT_PIN). */</span></div><div class="line"></div><div class="line">    <span class="comment">/* Enable the WCO without timeout */</span></div><div class="line">    (void)<a class="code" href="group__group__sysclk__wco__funcs.html#gaca35f4a96f042a9c84df82083277c41f">Cy_SysClk_WcoEnable</a>(0UL);</div><div class="line">    <span class="keywordflow">while</span>(!<a class="code" href="group__group__sysclk__wco__funcs.html#ga9e8ae5164397bf3bd0374d957405b9cf">Cy_SysClk_WcoOkay</a>())</div><div class="line">    {</div><div class="line">        <span class="comment">/* WCO is not yet ready. Perform some other operation. */</span></div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="comment">/* Set the backup clock source to WCO */</span></div><div class="line">    <a class="code" href="group__group__sysclk__clk__bak__funcs.html#gab72e0702bafe7df920708eacefdb40dd">Cy_SysClk_ClkBakSetSource</a>(<a class="code" href="group__group__sysclk__clk__bak__enums.html#ggae43abac127a973232c6e4c1adbde0497a9a82c90148622105cc000167a9b0428b">CY_SYSCLK_BAK_IN_WCO</a>);</div></div><!-- fragment --></dd></dl>

</div>
</div>
<a id="ga0990b94c499652b8f5c2dd1cf6abf95e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga0990b94c499652b8f5c2dd1cf6abf95e">&#9670;&nbsp;</a></span>Cy_SysClk_WcoDisable()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Cy_SysClk_WcoDisable </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Disables the WCO. </p>
<dl class="section note"><dt>Note</dt><dd>We need to set writable option using Cy_RTC_WriteEnable before disabling WCO, and clear writable option after disabling WCO.</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="comment">/* Scenario: LFCLK needs to be sourced by the PILO instead of the WCO. All</span></div><div class="line"><span class="comment">                 peripherals clocked by the LFCLK are disabled and the Watchdog</span></div><div class="line"><span class="comment">                 timer (WDT) is unlocked. */</span></div><div class="line"></div><div class="line">    <span class="comment">/* Disable the WCO */</span></div><div class="line">    <a class="code" href="group__group__sysclk__wco__funcs.html#ga0990b94c499652b8f5c2dd1cf6abf95e">Cy_SysClk_WcoDisable</a>();</div><div class="line"></div><div class="line">    <span class="comment">/* Enable the PILO */</span></div><div class="line">    <a class="code" href="group__group__sysclk__pilo__funcs.html#ga92e44b1390d7cabf2c597c45a5fdd309">Cy_SysClk_PiloEnable</a>();</div><div class="line"></div><div class="line">    <span class="comment">/* Set the LFCLK source to the PILO */</span></div><div class="line">    <a class="code" href="group__group__sysclk__clk__lf__funcs.html#ga446424e5edb0121a1c6c06e7d87cd054">Cy_SysClk_ClkLfSetSource</a>(<a class="code" href="group__group__sysclk__clk__lf__enums.html#gga8bfd6f85870f0d30d15e73b3ed820db6a51a3252aefb2b8198451b0d1589e47bf">CY_SYSCLK_CLKLF_IN_PILO</a>);</div></div><!-- fragment --></dd></dl>

</div>
</div>
<a id="gaf254b104b1e1020545103779a573da17"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf254b104b1e1020545103779a573da17">&#9670;&nbsp;</a></span>Cy_SysClk_WcoBypass()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Cy_SysClk_WcoBypass </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__sysclk__wco__enums.html#ga54c5465a9f694e1e71cf1ca2598d2fd7">cy_en_wco_bypass_modes_t</a>&#160;</td>
          <td class="paramname"><em>bypass</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sets whether the WCO is bypassed or not. </p>
<p>If it is bypassed, then a 32-kHz clock must be provided on the wco_out pin.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">bypass</td><td><a class="el" href="group__group__sysclk__wco__enums.html#ga54c5465a9f694e1e71cf1ca2598d2fd7">cy_en_wco_bypass_modes_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="comment">/* Scenario: An external watch crystal oscillator needs to be connected to</span></div><div class="line"><span class="comment">                 the WCO pins instead of a watch crystal. This signal needs</span></div><div class="line"><span class="comment">                 to source the backup clock for the real-time clock operation.</span></div><div class="line"><span class="comment">                 The WCO pins are configured using the gpio driver</span></div><div class="line"><span class="comment">                 (SRSS_WCO_IN_PIN, SRSS_WCO_OUT_PIN). */</span></div><div class="line"></div><div class="line">    <span class="comment">/* WCO bypassed mode - 32768 kHz square-wave supplied through SRSS_WCO_OUT_PIN pin */</span></div><div class="line">    <a class="code" href="group__group__sysclk__wco__funcs.html#gaf254b104b1e1020545103779a573da17">Cy_SysClk_WcoBypass</a>(<a class="code" href="group__group__sysclk__wco__enums.html#gga54c5465a9f694e1e71cf1ca2598d2fd7a71a9b78b95df656646dbae3aa9d84329">CY_SYSCLK_WCO_BYPASSED</a>);</div><div class="line"></div><div class="line">    <span class="comment">/* Enable the WCO with a timeout of 2000 microsecond */</span></div><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__sysclk__returns.html#ggad6699a184e2e3c01433251b0981558f3a1563f761f963757b339ff05eb5a690ec">CY_SYSCLK_SUCCESS</a> != <a class="code" href="group__group__sysclk__wco__funcs.html#gaca35f4a96f042a9c84df82083277c41f">Cy_SysClk_WcoEnable</a>(2000UL))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="comment">/* Set the backup clock source to WCO */</span></div><div class="line">    <a class="code" href="group__group__sysclk__clk__bak__funcs.html#gab72e0702bafe7df920708eacefdb40dd">Cy_SysClk_ClkBakSetSource</a>(<a class="code" href="group__group__sysclk__clk__bak__enums.html#ggae43abac127a973232c6e4c1adbde0497a9a82c90148622105cc000167a9b0428b">CY_SYSCLK_BAK_IN_WCO</a>);</div></div><!-- fragment --></dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>MTB CAT1 Peripheral driver library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
